<template>
  <el-table
      ref="singleTable"
      :border="true"
      :data="list"
      highlight-current-row
      max-height="680"
      show-summary
      style="width: 100%"
      stripe

  >
    <el-table-column
        label="序号"
        sortable
        type="index"
        width="50"
    />
    <el-table-column label="活动名称"
                     sortable
    >
      <template slot-scope="scope">
              <span
                  style="color: #00a0e9; cursor: pointer"
                  @click="handleGetActivityInfo(scope.row.activityId)"
              >
                {{ scope.row.activityName }}</span
              >
      </template>
    </el-table-column>

    <el-table-column label="活动内容"
                     sortable
                     min-width="890"
    >
      <template slot-scope="scope">
        <span>{{ scope.row.activityDisc }}</span>
      </template>
    </el-table-column>
    <el-table-column
        v-for="item in data_setting"
        :key="item.target"
        :label="item.target|translate"
        :prop="item.target"
        sortable
        min-width="100"
    />

    <el-table-column
        v-if="needScore"
        label="活动积分"
        prop="activityRecruitedPeople"
        sortable
        width="50"
    />
    <el-table-column label="活动费用" prop="activityMoney" width="100">
      <template slot-scope="scope">
        <!--          直接使用钱数量判断是否收费，也可以使用filter 进行过滤-->
        <span>{{ scope.row.activityMoney | isChargeFree }}</span>
      </template>
    </el-table-column>
    <el-table-column v-if="needCtrl" label="操作" width="200">
      <template slot-scope="scope">
        <slot :info="scope.row" name="ctrl"/>
      </template>
    </el-table-column>

  </el-table>
</template>

<script>
export default {
  name: "activity_table",
  props: {
    list: Array,
    data_setting: Array,
    needCtrl: Boolean,
    needScore: Boolean,
  },
  methods: {
    handleGetActivityInfo (info) {
      this.$emit("handleGetActivityInfo", info);
    },
  },
};
</script>

<style scoped>

</style>
